﻿using MediatR;
using Microsoft.AspNetCore.Http.HttpResults;
using System.ComponentModel.Design;
using T.Settlement.API.Application.Command.ExpensesCommand;
using T.Settlement.Repository.SettlementInterface;

namespace T.Settlement.API.Application.CommandHandlers.ExpensesHandler
{
    public class ExpensesAddCommandHandler : IRequestHandler<ExpensesAddCommand, int>
    {
        private readonly IExpensesSRepository _repository;
        public ExpensesAddCommandHandler(IExpensesSRepository repository)
        {
            _repository = repository;
        }
        /// <summary>
        /// 添加应付/收费
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<int> Handle(ExpensesAddCommand request, CancellationToken cancellationToken)
        {
            return await _repository.AddAsync(request);
        }
    }
}
